#!/usr/bin/env python
"""
Acorn-SDR (A Collaboration of Radio Nodes)
(c) Bob Cowdery (G3UKB) 2009

File: softrock_controller.py
Date: January 2009

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

The author can be reached by email at

bob@g3ukb.co.uk

========================================================================
Module Description:

This is a dummy for now but it does serve as a source for events.

"""

#-----------------------------------------------------------------------
# System imports
import logging
import sys
import os

# Application imports
import sdr1khw

#======================================================================
# The Softrock controller class
class SoftrockController:
    
    #-------------------------------------------------------------------
    def __init__(self, pub):
        
        # Stash the event service proxy
        self.pub= pub
        
        # Initialise the frequency
        self.freq = 0.0
        
    #-------------------------------------------------------------------
    # Message handlers
    # Note some also reflect the change. Try not to double up on these messages.
    #-------------------------------------------------------------------
        
    #-------------------------------------------------------------------
    def freq_set(self, freq):
        self.freq = freq
        self.pub.freqUpdate(self.freq)
        
    #-------------------------------------------------------------------
    def freq_inc(self, inc):
        new_freq = self.freq + inc
        self.pub.freqUpdate(self.freq)
    